home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 001-025 / disk_004 / mandel / mand.c < prev    next >
C/C++ Source or Header  |  1992-05-06  |  22KB  |  712 lines

  1. /*
  2.                     MAND.C - Command parsing
  3.             Mandelbrot's Self-Squared Dragon Generator
  4.                     For the Commodore Amiga
  5.                          Version 1.00
  6.  
  7.          Inspired by Scientific American, August/1985
  8.  
  9.            Corrections and improvements suggested by
  10.                   The Fractal Geometry of Nature
  11.      By Benoit Mandelbrot, W.H. Freeman and Company, 1983
  12.           (Used to be Z=Z^2+C, now is Z=Z^2-u, etc.)
  13.  
  14.              Copyright (C) 1985, Robert S. French
  15.                   Placed in the Public Domain
  16.  
  17.      Assorted Goodies and Intuition-stuff by =RJ Mical=  1985
  18.       Hope you appreciate them.  I especially like the zoom.
  19.  
  20. This program may be distributed free of charge as long as the above
  21. notice is retained.
  22.  
  23. Please see the accompanying documentation for more information.
  24.  
  25. Send ANY problems or suggestions to the address in the <I>nformation
  26. section.  Thank you!
  27.  
  28. Programs should be compiled with:
  29.  
  30. 1> lc -i:include/ -i:include/lattice/ mand.c
  31. 1> lc -i:include/ -i:include/lattice/ mand1.c
  32. 1> lc -i:include/ -i:include/lattice/ mand2.c
  33. 1> lc -i:include/ -i:include/lattice/ mand3.c
  34. 1> lc -i:include/ -i:include/lattice/ mand4.c
  35. 1> alink :lib/Lstartup.obj+mand.o+mand1.o+mand2.o+mand3.o+mand4.o to mand lib :lib/lc.lib+:lib/amiga.lib
  36.  
  37. */
  38.  
  39.  
  40. /* ===========================================================================
  41.    ===========================================================================
  42. From: "french robert%d.mfenet"@LLL-MFE.ARPA
  43.  
  44. Well guys, you asked for it, and here it is.  There are two parts to the
  45. Mandelbrot Set Generator which must be linked together (instructions are
  46. at the beginning of the file).  I don't have any of the documentation
  47. written yet, so you're on your own for a while.  I'll upload it when I get
  48. it finished.  I can't send files over 16K thru the net, so the first
  49. section is sent as two files...just JOIN them together.  Right now, the
  50. program seems to work without any problems, except for an occasional
  51. mysterious crash and the problem with closing a window in the middle of
  52. picture generation (see comments in MAND1.C).  Please send me any comments
  53. or suggestions.
  54.  
  55. By the way, on a historical note, the "Mandelbrot Set" as related in
  56. Scientific American is a little different from the u-Map implemented
  57. here (as discussed in Mandelbrot's "The Fractal Geometry of Nature").
  58. The main difference is the use of Z -> Z 2+C in Scientific American vs.
  59. Z -> Z 2-u in the book and this program.  The primary effect is the reversal
  60. of the picture across the Y axis.
  61.  
  62. Enjoy!
  63.  
  64.                  Robert French
  65.                  French#Robert%d@LLL-MFE.ARPA
  66.  
  67.    ========================================================================
  68.    ======================================================================== */
  69.  
  70. #include "mand.h"
  71.  
  72.  
  73. int MathBase,MathTransBase;
  74.  
  75.  
  76. /*----------------------*/
  77. /* Graphics definitions */
  78.  
  79. struct   GfxBase       *GfxBase;
  80. struct   IntuitionBase *IntuitionBase;
  81.  
  82.  
  83. /*----------------------------------*/
  84. /* Miscellaneous Global Definitions */
  85.  
  86. union kludge {
  87.    float f;
  88.    int i;
  89. } start_r,end_r,start_i,end_i;
  90. int max_x,max_y,max_mem_y;
  91. int max_count,color_inc,color_offset,color_set,color_mode,color_div;
  92. int color_inset,func_num;
  93.  
  94. int v_starty,max_mem;
  95. long v_offset;
  96. UWORD *color_table,*v_mand_store;
  97.  
  98. int modified,want_read;
  99.  
  100. FILE *console,*v_fp = NULL,*redir_fp = NULL;
  101.  
  102. SHORT ZoomCenterX, ZoomCenterY, ZoomBoxSizeX, ZoomBoxSizeY;
  103. SHORT ZoomBoxStartX, ZoomBoxStartY;
  104.  
  105. int cur_resource = NULL;
  106.  
  107.  
  108. /*-------------*/
  109. /* Here we go! */
  110.  
  111. main()
  112. {
  113.    FILE *fopen();
  114.    char *fgets(),*stpblk();
  115.    float cnvf();
  116.    void anal_mand(),wait_close();
  117.  
  118.    int temp,y;
  119.    char *cmd,inp_buf[80],secchar,*argpos;
  120.    union kludge scale;
  121.    FILE *fp;
  122.  
  123.    max_mem_y = MAXMY;
  124.  
  125.    color_table = (UWORD *)malloc(4096*sizeof(UWORD));
  126.    if (color_table == NULL)
  127.       abort("Can't allocate memory for color table");
  128.    cur_resource |= F_COLORTAB;
  129.  
  130.    v_mand_store = (UWORD *)malloc(MAXX*max_mem_y*sizeof(UWORD));
  131.    if (v_mand_store == NULL)
  132.       abort("Can't allocate memory for set storage");
  133.    cur_resource |= F_SETSTORE;
  134.  
  135.    MathBase = OpenLibrary("mathffp.library",0);
  136.    if (MathBase < 1)
  137.       abort("Can't open mathffp.library");
  138.    cur_resource |= F_MATH;
  139.  
  140.    MathTransBase = OpenLibrary("mathtrans.library",0);
  141.    if (MathTransBase < 1)
  142.       abort("Can't open mathtrans.library");
  143.    cur_resource |= F_MATHTRANS;
  144.  
  145.    GfxBase = (struct GfxBase *)OpenLibrary("graphics.library",0);
  146.    if (GfxBase == NULL)
  147.       abort("Can't open graphics.library");
  148.    cur_resource |= F_GRAPHICS;
  149.  
  150.    IntuitionBase = (struct IntuitionBase *)OpenLibrary("intuition.library",0);
  151.    if (IntuitionBase == NULL)
  152.       abort("Can't open intuition.library");
  153.    cur_resource |= F_INTUITION;
  154.  
  155.    console = fopen("con:0/0/640/200/Mandelbrot Commands","w+");
  156.    if (console == NULL)
  157.       abort("Can't open console window");
  158.    cur_resource |= F_CONSOLE;
  159.  
  160.    fprintf(console,
  161.       "Mandelbrot Self-Squared Dragon Generator - Version %s\n",VERSION);
  162.    fputs("Copyright (C) 1985, Robert S. French\n",console);
  163.    fputs("Power, Goodies, and Baubles by =RJ Mical= 1985\n",console);
  164.    fputs("Placed in the public domain.\n",console);
  165.    fputs("Type '?' or 'H' or <RETURN> for help\n\n",console);
  166.  
  167.    SetPresets(0);
  168.  
  169.    for (EVER) {
  170.  
  171. command:
  172.  
  173.       fprintf(console,"Command: ");
  174.       rewind(console);
  175.       if (redir_fp)
  176.          if (Chk_Abort()) {
  177.             fputs("\nRedirected input aborted!\n",console);
  178.             fclose(redir_fp);
  179.             redir_fp = NULL;
  180.          }
  181.          else {
  182.             cmd = fgets(inp_buf,78,redir_fp);
  183.             if (cmd == NULL) {
  184.                fputs("End of file encountered.\n",console);
  185.                fclose(redir_fp);
  186.                redir_fp = NULL;
  187.                cmd = fgets(inp_buf,40,console);
  188.             }
  189.             else
  190.                fputs(inp_buf,console);
  191.          }
  192.       else
  193.          cmd = fgets(inp_buf,40,console);
  194.       *(cmd+strlen(cmd)-1) = '\0';
  195.       secchar = toupper(*(cmd+1));
  196.       argpos = stpblk(cmd+2);
  197.       rewind(console);
  198.       switch (toupper(*cmd)) {
  199.          case 'I':
  200.             sscanf(argpos,"%d",&temp);
  201.         Information(temp);
  202.             goto command;
  203.          case 'S':
  204.             if (secchar == 'R') {
  205.                sscanf(argpos,"%f",&start_r.f);
  206.                start_r.i = SPFieee(start_r.i);
  207.                if (v_fp) {
  208.                   fclose(v_fp);
  209.                   v_fp = NULL;
  210.                }
  211.                goto command;
  212.             }
  213.             if (secchar == 'I') {
  214.                sscanf(argpos,"%f",&start_i.i);
  215.                start_i.i = SPFieee(start_i.i);
  216.                if (v_fp) {
  217.                   fclose(v_fp);
  218.                   v_fp = NULL;
  219.                }
  220.                goto command;
  221.             }
  222.             if (secchar == 'H') {
  223.                fputs("Current settings:\n",console);
  224.                fprintf(console,"MaxX=%d, MaxY=%d, SR=%f, ER=%f, SI=%f, EI=%f, F=%d\n",
  225.                   max_x,max_y,cnvf(start_r.i),cnvf(end_r.i),cnvf(start_i.i),
  226.                   cnvf(end_i.i),func_num);
  227.                fprintf(console,"MaxC=%d, CI=%d, CO=%d, CS=%d, CM=%d, CD=%d, CT=%d MM=%d\n",
  228.                   max_count,color_inc,color_offset,color_set,color_mode,color_div,color_inset, max_mem_y);
  229.                goto command;
  230.             }
  231.             if (secchar == 'A') {
  232.                fp = fopen(argpos,"w");
  233.                if (fp == NULL) {
  234.                   fprintf(console,"Cannot open file '%s'\n",argpos);
  235.                   goto command;
  236.                }
  237.                putc((char) 1,fp);
  238.                fwrite(&start_r,sizeof(start_r),1,fp);
  239.                fwrite(&start_i,sizeof(start_i),1,fp);
  240.                fwrite(&end_i,sizeof(end_i),1,fp);
  241.                fwrite(&max_x,sizeof(max_x),1,fp);
  242.                fwrite(&max_y,sizeof(max_y),1,fp);
  243.                want_read = TRUE;
  244.                for (y=0;y<max_y;y++) {
  245.                   v_pos_line(y);
  246.                   if(fwrite(v_mand_store+(y-v_starty)*max_x,
  247.                             max_x*sizeof(UWORD),1,fp) != 1) {
  248.                      fputs("Error while writing to file\n",console);
  249.                      break;
  250.                   }
  251.                }
  252.                fclose(fp);
  253.                goto command;
  254.             }
  255.             ill_cmd();
  256.             goto command;
  257.          case 'E':
  258.             if (secchar == 'R') {
  259.                sscanf(argpos,"%f",&end_r.i);
  260.                end_r.i = SPFieee(end_r.i);
  261.                if (v_fp) {
  262.                   fclose(v_fp);
  263.                   v_fp = NULL;
  264.                }
  265.                goto command;
  266.             }
  267.             if (secchar == 'I') {
  268.                sscanf(argpos,"%f",&end_i.i);
  269.                end_i.i = SPFieee(end_i.i);
  270.                if (v_fp) {
  271.                   fclose(v_fp);
  272.                   v_fp = NULL;
  273.                }
  274.                goto command;
  275.             }
  276.             ill_cmd();
  277.             goto command;
  278.          case 'M':
  279.             if (secchar == 'X') {
  280.                sscanf(argpos,"%d",&temp);
  281.                if (temp < 5 ||
  282.                      (temp > 320 && !(color_mode & 4)) ||
  283.                      (temp > 640 && (color_mode & 4))) {
  284.                   fputs("Illegal parameter!\n",console);
  285.                   goto command;
  286.                }
  287.                max_x = temp;
  288.                max_mem = max_mem_y * MAXX;
  289.                max_mem /= max_x;
  290.                if (v_fp) {
  291.                   fclose(v_fp);
  292.                   v_fp = NULL;
  293.                }
  294.                goto command;
  295.             }
  296.             if (secchar == 'Y') {
  297.                sscanf(argpos,"%d",&temp);
  298.                if (temp < 5 ||
  299.                      (temp > 200-STARTY && !(color_mode & 2)) ||
  300.                      (temp > 400-STARTY && (color_mode & 2))) {
  301.                   fputs("Illegal parameter!\n",console);
  302.                   goto command;
  303.                }
  304.                max_y = temp;
  305.                if (v_fp) {
  306.                   fclose(v_fp);
  307.                   v_fp = NULL;
  308.                }
  309.                goto command;
  310.             }
  311.             if (secchar == 'C') {
  312.                sscanf(argpos,"%d",&temp);
  313.                if (temp * color_inc + color_offset > 4095) {
  314.                   fputs("More than 4096 colors!\n",console);
  315.                   goto command;
  316.                }
  317.                if (temp < 2) {
  318.                   fputs("MaxCount must be greater than 1\n",console);
  319.                   goto command;
  320.                }
  321.                max_count = temp;
  322.                goto command;
  323.             }
  324.             if (secchar == 'M') {
  325.                sscanf(argpos,"%d",&temp);
  326.                if (temp < 5) {
  327.                   fputs("Number of lines must be >4!\n",console);
  328.                   goto command;
  329.                }
  330.                free(v_mand_store);
  331.                v_mand_store = (UWORD *)malloc(MAXX*temp*sizeof(UWORD));
  332.                if (v_mand_store == NULL) {
  333.                   fputs("Can't allocate that much memory for set storage",console);
  334.                   v_mand_store = (UWORD *)malloc(MAXX*max_mem_y*sizeof(UWORD));
  335.                   if (v_mand_store == NULL)
  336.                      abort("Can't reallocate memory!!!");
  337.                   goto command;
  338.                }
  339.                max_mem_y = temp;
  340.                if (v_fp) {
  341.                   fclose(v_fp);
  342.                   v_fp = NULL;
  343.                }
  344.                max_mem = MAXX * max_mem_y;
  345.                max_mem /= max_x;
  346.                goto command;
  347.             }
  348.             ill_cmd();
  349.             goto command;
  350.          case 'L':
  351.             if (v_fp) {
  352.                fclose(v_fp);
  353.                v_fp = NULL;
  354.             }
  355.             v_fp = fopen(stpblk(cmd+1),"r");
  356.             if (v_fp == NULL) {
  357.                fprintf(console,"Cannot open file '%s'\n",stpblk(cmd+1));
  358.                goto command;
  359.             }
  360.             if (getc(v_fp) != 1) {
  361.                fputs("File is not in proper format\n",console);
  362.                fclose(v_fp);
  363.                v_fp = NULL;
  364.                goto command;
  365.             }
  366.             fread(&start_r,sizeof(start_r),1,v_fp);
  367.             fread(&end_r,sizeof(end_r),1,v_fp);
  368.             fread(&start_i,sizeof(start_i),1,v_fp);
  369.             fread(&end_i,sizeof(end_i),1,v_fp);
  370.             fread(&max_x,sizeof(max_x),1,v_fp);
  371.             fread(&max_y,sizeof(max_y),1,v_fp);
  372.             v_offset = 25L;
  373.             modified = FALSE;
  374.             v_starty = max_mem+1;
  375.             want_read = TRUE;
  376.             v_pos_line(0);
  377.             goto command;
  378.          case 'X':
  379.             if (secchar == 'R') {
  380.                sscanf(argpos,"%f",&scale.f);
  381.                scale.i = SPFieee(scale.i);
  382.                start_r.i = SPAdd(start_r.i,scale.i);
  383.                end_r.i = SPAdd(end_r.i,scale.i);
  384.                if (v_fp) {
  385.                   fclose(v_fp);
  386.                   v_fp = NULL;
  387.                }
  388.                goto command;
  389.             }
  390.             if (secchar == 'I') {
  391.                sscanf(argpos,"%f",&scale.f);
  392.                scale.i = SPFieee(scale.i);
  393.                start_i.i = SPAdd(start_i.i,scale.i);
  394.                end_i.i = SPAdd(end_i.i,scale.i);
  395.                if (v_fp) {
  396.                   fclose(v_fp);
  397.                   v_fp = NULL;
  398.                }
  399.                goto command;
  400.             }
  401.             ill_cmd();
  402.             goto command;
  403.          case 'Z':
  404.             if (secchar != 'R' && secchar != 'I' && secchar != 'B') {
  405.                ill_cmd();
  406.                goto command;
  407.             }
  408.             if (v_fp) {
  409.                fclose(v_fp);
  410.                v_fp = NULL;
  411.             }
  412.             if (secchar != 'I' ) {
  413.                /* scale along the real axis */
  414.                sscanf(argpos,"%f",&scale.f);
  415.            ZoomAlongDarling(SPFieee(scale.i), SPFlt(1));
  416.             }
  417.             if (secchar != 'R') {
  418.                /* scale along the complex axis */
  419.                sscanf(argpos,"%f",&scale.f);
  420.            ZoomAlongDarling(SPFlt(1), SPFieee(scale.i));
  421.             }
  422.             goto command;
  423.          case 'C':
  424.             if (secchar == 'I') {
  425.                sscanf(argpos,"%d",&temp);
  426.                if (max_count * temp + color_offset > 4095) {
  427.                   fputs("More than 4096 colors!\n",console);
  428.                   goto command;
  429.                }
  430.                if (temp < 1) {
  431.                   fputs("Increment must be greater than 0!\n",console);
  432.                   goto command;
  433.                }
  434.                color_inc = temp;
  435.                goto command;
  436.             }
  437.             if (secchar == 'O') {
  438.                sscanf(argpos,"%d",&temp);
  439.                if (max_count * color_inc + temp > 4095) {
  440.                   fputs("More than 4096 colors!\n",console);
  441.                   goto command;
  442.                }
  443.                if (temp < 0) {
  444.                   fputs("Negative offset illegal!\n",console);
  445.                   goto command;
  446.                }
  447.                color_offset = temp;
  448.                goto command;
  449.             }
  450.             if (secchar == 'S') {
  451.                sscanf(argpos,"%d",&temp);
  452.                if (temp < 0 || temp > 1) {
  453.                   fputs("Illegal color set!\n",console);
  454.                   goto command;
  455.                }
  456.                color_set = temp;
  457.                init_colors();
  458.                goto command;
  459.             }
  460.             if (secchar == 'M') {
  461.                sscanf(argpos,"%d",&temp);
  462.                if (temp < 0 || temp > 7 || ((temp&4) && !(temp&1))) {
  463.                   fputs("Illegal graphics mode!\n",console);
  464.                   goto command;
  465.                }
  466.                color_mode = temp;
  467.                if (!(color_mode & 0x2))
  468.                   if (max_y > 200-STARTY)
  469.                      max_y = 200-STARTY;
  470.                if (!(color_mode & 0x4))
  471.                   if (max_x > 320)
  472.                      max_x = 320;
  473.                goto command;
  474.             }
  475.             if (secchar == 'D') {
  476.                sscanf(argpos,"%d",&temp);
  477.                if (temp < 1) {
  478.                   fputs("Divisor must be greater than 0!\n",console);
  479.                   goto command;
  480.                }
  481.                color_div = temp;
  482.                goto command;
  483.             }
  484.             if (secchar == 'T') {
  485.                sscanf(argpos,"%d",&temp);
  486.                if (temp < 0 || temp > 4095) {
  487.                   fputs("Color must be between 0 and 4095!\n",console);
  488.                   goto command;
  489.                }
  490.                color_inset = temp;
  491.                goto command;
  492.             }
  493.             ill_cmd();
  494.             goto command;
  495.          case 'F':
  496.             sscanf(stpblk(cmd+1),"%d",&temp);
  497.             if (temp < 0 || temp > 1) {
  498.                fputs("Function number must be 0 or 1!\n",console);
  499.                goto command;
  500.             }
  501.             func_num = temp;
  502.             goto command;
  503.          case 'P':
  504.             sscanf(stpblk(cmd+1),"%d",&temp);
  505.             SetPresets(temp);
  506.             goto command;
  507.          case 'D':
  508.             if (v_fp == NULL) {
  509.                fputs("Must <G>enerate or <L>oad first!\n",console);
  510.                goto command;
  511.             }
  512.             if (disp_mand() == NULL)
  513.                wait_close();
  514.             goto command;
  515.          case 'G':
  516.             if (gen_mand() == NULL)
  517.                wait_close();
  518.             goto command;
  519.          case 'A':
  520.             if (v_fp == NULL) {
  521.                fputs("Must <G>enerate or <L>oad first!\n",console);
  522.                goto command;
  523.             }
  524.             if (!(color_mode & 1)) {
  525.                fputs("Cannot be in hold and modify!\n",console);
  526.                goto command;
  527.             }
  528.             anal_mand();
  529.             goto command;
  530.          case ';':
  531.             goto command; /* Lattice will complain about this line! */
  532.          case '<':
  533.             if (redir_fp) {
  534.                fclose(redir_fp);
  535.                redir_fp == NULL;
  536.             }
  537.             redir_fp = fopen(stpblk(cmd+1),"r");
  538.             if (redir_fp == NULL)
  539.                fprintf(console,"Can't open file %s!\n",stpblk(cmd+1));
  540.             goto command;
  541.          case 'Q':
  542.             abort("Bye!");
  543.          case '?':
  544.          case 'H':
  545.          default:
  546.             AvailableCommands();
  547.             goto command;
  548.       }
  549.    }
  550. }
  551.  
  552. ill_cmd()
  553. {
  554.    fputs("Unknown command!\n",console);
  555. }
  556.  
  557. float cnvf(i)
  558. int i;
  559. {
  560.    union kludge n;
  561.  
  562.    n.i = i;
  563.    n.i = SPTieee(n.i);
  564.    return (n.f);
  565. }
  566.  
  567.  
  568. /*-----------------------------------------*/
  569. /* Non-intelligent virtual memory handling */
  570.  
  571. v_pos_line(l)
  572. int l;
  573. {
  574.    if (l < v_starty) {
  575.       if (modified) 
  576.          v_flush();
  577.       v_starty = 0;
  578.       fseek(v_fp,v_offset,0);
  579.       if (want_read)
  580.          fread(v_mand_store,max_x*sizeof(UWORD),max_mem,v_fp);
  581.    }
  582.    if (l-v_starty > max_mem-1) {
  583.       if (modified)
  584.          v_flush();
  585.       v_starty += max_mem;
  586.       fseek(v_fp,(long)(v_starty*max_x*sizeof(UWORD)+v_offset),0);
  587.       if (want_read)
  588.          fread(v_mand_store,max_x*sizeof(UWORD),max_mem,v_fp);
  589.    }
  590. }
  591.  
  592. v_flush()
  593. {
  594.    fseek(v_fp,(long)(v_starty*max_x*sizeof(UWORD)+v_offset),0);
  595.    fwrite(v_mand_store,max_x*sizeof(UWORD),max_mem,v_fp);
  596.    modified = FALSE;
  597. }
  598.  
  599. abort(s)
  600. char *s;
  601. {
  602.    if (cur_resource & F_MATHTRANS)
  603.       CloseLibrary(MathTransBase);
  604.    if (cur_resource & F_MATH)
  605.       CloseLibrary(MathBase);
  606.    if (cur_resource & F_CONSOLE)
  607.       fclose(console);
  608.    if (v_fp)
  609.       fclose(v_fp);
  610.    if (redir_fp)
  611.       fclose(redir_fp);
  612.    if (cur_resource & F_GRAPHICS)
  613.       CloseLibrary(GfxBase);
  614.    if (cur_resource & F_INTUITION)
  615.       CloseLibrary(IntuitionBase);
  616.    if (cur_resource & F_SETSTORE)
  617.       free(v_mand_store);
  618.    if (cur_resource & F_COLORTAB)
  619.       free(color_table);
  620.  
  621.    CloseDisplay();
  622.  
  623.    puts(s);
  624.    exit(0);
  625. }
  626.  
  627.  
  628. SetPresets(preset)
  629. {
  630.    /* these are some common defaults, preset here to avoid repetitive
  631.     * assignments in the case statements below.  Feel free to override
  632.     * any of these defaults with your own in the case statements below
  633.     */
  634.    max_x = 320;
  635.    max_y = 200;
  636.    max_count = 29;
  637.    color_inc = 1;
  638.    color_set = 1;
  639.    color_mode = 1;
  640.    color_div = 1;
  641.  
  642.    switch (preset)
  643.       {
  644.       case 0:
  645.          fputs("Mandelbrot's Set\n", console);
  646.          start_r.f = -2.85;
  647.          end_r.f = 2.85;
  648.          start_i.f = -2.05;
  649.          end_i.f = 2.05;
  650.          max_count = 15;
  651.          color_offset = 91;
  652.          break;
  653.       case 1:
  654.          fputs("Unbounded Rhythms\n", console);
  655.          start_r.f = 1.703418;
  656.          end_r.f = 2.016930;
  657.          start_i.f = -0.169450;
  658.          end_i.f = 0.169450;
  659.          color_offset = 31;
  660.          break;
  661.       case 2:
  662.          fputs("RJ's Gangliactic\n", console);
  663.          start_r.f = 1.937821;
  664.          end_r.f = 1.945044;
  665.          start_i.f = -0.00259;
  666.          end_i.f = 0.00259;
  667.          color_offset = 31;
  668.          break;
  669.       case 3:
  670.          fputs("Mandelbrot Recursion\n", console);
  671.          start_r.f = -0.294473;
  672.          end_r.f = -0.288444;
  673.          start_i.f = 0.012677;
  674.          end_i.f = 0.014839;
  675.          color_offset = 26;
  676.          max_count = 30;
  677.          break;
  678.       case 4:
  679.          fputs("Crackle\n", console);
  680.          start_r.f = 0.225;
  681.          end_r.f = 0.275;
  682.          start_i.f = 0.8425;
  683.          end_i.f = 0.8525;
  684.          color_offset = 61;
  685.          max_count = 31;
  686.          break;
  687.       case 5:
  688.          fputs("Connections\n", console);
  689.          start_r.f = 0.115206;
  690.          end_r.f = 0.168190;
  691.          start_i.f = -1.036059;
  692.          end_i.f = -0.985386;
  693.          color_offset = 76;
  694.          color_inc = 2;
  695.          break;
  696.       default:
  697.         fputs("SORRY:  there's not that many presets!\n",console);
  698.         break;
  699.       }
  700.    
  701.    ZoomCenterX = max_x >> 1;
  702.    ZoomCenterY = max_y >> 1;
  703.    ZoomBoxSizeX = max_x;
  704.    ZoomBoxSizeY = max_y;
  705.    start_r.i = SPFieee(start_r.i);
  706.    end_r.i = SPFieee(end_r.i);
  707.    start_i.i = SPFieee(start_i.i);
  708.    end_i.i = SPFieee(end_i.i);
  709.    max_mem = max_mem_y * MAXX / max_x;
  710.    init_colors();
  711. }
  712.